<?php $this->_extends('_layouts/admin/main_layout'); ?>

<?php $this->_block('resource'); ?>
<script type="text/javascript" src="<?php echo $plugin_url; ?>jquery-confirm/jquery.confirm.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $plugin_url; ?>jquery-confirm/jquery.confirm.css" />

<?php $this->_endblock(); ?>

<?php $this->_block('title'); ?>
	Jquery Plugins
<?php $this->_endblock(); ?>

<?php $this->_block('contents'); ?>

<div id="content" class="box">
	<h1>已添加的Jquery插件</h1>
	
	<div id="menu" class="box">
		<ul class="box">
			<li><a href="<?php echo url('adminjqueryplugins/add');?>"><span>添加</span></a></li>
		</ul>
	</div>
	
	<fieldset>
		<legend>已添加的Jquery插件</legend>
		<table class="full-size" style="text-align: center;">
			<thead>
				<tr>
					
					<th style="width:5%">名称</th>
					<th style="width:20%">描述</th>
					<th style="width:5%">根目录文件夹</th>
					<th style="width:5%">缩略图 </th>
					<th style="width:5%">下载包</th>
					<th style="width:3%">点击数</th>
					<th style="width:10%">生成日期</th>
					<th style="width:5%">操作</th>
				</tr>
			</thead>
			<tbody>
				<?php if(!empty($jqueryplugins)): foreach($jqueryplugins as $jp): ?>
					<tr>
						<td class="name"><?php echo $jp['name']; ?></td>
						<td class="description"><?php echo $jp['description']; ?></td>
						<td class="root_foldername"><?php echo $jp['root_foldername']; ?></td>
						<td class="thumb">
							<img alt="<?php echo $jp['name']; ?>" width="100" height="70" src="<?php echo $jqplugin_url . $jp['root_foldername'] . '/' . $jp['thumbnail']; ?>" /> <br />
							<?php echo $jp['thumbnail']; ?>
						</td>
						<td class="download_pack"><?php echo $jp['download_pack']; ?></td>
						<td><?php echo $jp['view_num']; ?></td>
						<td><?php echo $jp['created_date']; ?></td>
						<td>
							<a href="<?php echo url('adminjqueryplugins/edit', array('id' => $jp['id'])); ?>" class="edit_btn">编辑</a>
							<a class="delete_btn" href="<?php echo url('adminjqueryplugins/index', array('ope' => 'delete', 'id' => $jp['id'])); ?>">删除</a>
						</td>
					</tr>
				<?php endforeach; endif; ?>
			</tbody>
		</table>
	</fieldset>
</div>

<script>
$('.delete_btn').click(function(){
	var thisObj = $(this);
	$.confirm({
		'title': '询问',
		'message': '确定删除?<br /><br /> <input type="checkbox" id="deletedispfilecheck" /><label for="deletedispfilecheck">同时删除磁盘上的文件</label>',
		'buttons': {
			'Yes': {
				'class': 'blue',
				'action': function(){
					if($('#deletedispfilecheck').attr('checked')){
						window.location.href = thisObj.attr('href') + '?deleteFiles=1';
					}else{
						window.location.href = thisObj.attr('href') + '?deleteFiles=0';
					}
				}
			},
			'No': {
				'class': 'gray',
				'action': function(){
					
				}
			}
		}
	});

	return false;
});
</script>
<?php $this->_endblock(); ?>